Part Number Hot Search : 
TDA460 15000 MC543050 ST110021 01700 1608S LA4425 GAL22V
Product Description
Full Text Search
 

To Download ST52E301C Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? st52t301/e301 8-bit otp/eprom dualogic ? mcus with adc, uart, timer, triac & pwm driver advanced data sheet high speed dedicated structures for fuzzy logic (3.5 m s to compute a 4 in x 1 out rule) capability to perform simple boolean and arithmetic operations up to 4 input, 2 output configurablevariables for each fuzzy algorithm and up to 300 rules up to 16 triangularand trapezoidalmembership functions for each input variable up to 256 singleton membership functions for all consequents program and data eprom: 2 kbytes 16 general purpose registers available as register file working clock frequencies: 5, 10 and 20mhz on-chip clock oscillator driven by quartz crystal or ceramic resonator one external interrupt standard ttl compatible input cmos compatible output 4 channel 8 bit analog to digital converter bandgap reference 2.5v digital 8 bit i/o port indepedently programmable with handshake signal serial communication interface with asynchronous protocol (uart) programmable timer with internal prescaler internal power fuzzy control to drive external triac (up to 25ma source, 50 ma sink current) internal fuzzy controlled pwm to drive an external power device software tools and emulators availability windowed and one time programmable (otp) memory parts available for prototyping and production phases 44 pin plastic (plcc44) and ceramic windowed leaded chip carrier (clcc44-w) july 1998 clcc44-w plcc44 1.1 general description st52e301 (1) and st52t301 (1) devices are members of the w.a.r.p.family of 8-bit dualogic ? microcontrollers. they are able to perform, in an efficient way, both booleanand fuzzy algorithms, in order to reach the best performances that the two methodologies allow. thest52e301is the erasableepromversion and the st52t301 is the otp version. the st52x301 is completely developed and produced by stmicroelectronics using the reliable high performance cmosm5e (o.7 m m) process. thanks to fuzzy logic, st52x301 allows to describe a problem using a linguistic model instead of a mathematicalmodel. in thisway it is very useful and easy to modelize complex system with very high accuracy. the linguistic approach is based on a set of if-then rules, describing the control behaviour, and on membership functions associated to input and output variables. fuzzy inference is a set of operations which computes the output values according with the truth values of the involved rules. note: (1) formerly w.a.r.p.3tc 1/99
the flexible i/o configuration of st52x301 allows to interface with a wide range of external devices, like d/a converters, power control devices (scrs, triacs) and external sensors. the otp (one time programmable) device is fully compatible with the eprom windowed version, which may be used to create prototype systems and for the pre-production phases. the fuzzy core includes the fuzzifier (alpha calculator), the inference unit and the defuzzifier. it allows to manage up to 300 rules (4 inputs and 1 output). the rules could be shared in different fuzzy subroutines that can be activated by user defined conditions. the i/o capabilities, demanded from microcontroller applications, are fulfilled by st52x301 with 4 analog inputs, an asynchronous peripheral interface (uart) and an 8-bit i/o communicationport in orderto transferdata from/to the on-chip register file. the voltage reference provides biasing to the analog portion of the internal circuitry. the internal reference is a 2.5v bandgap reference. the voltage reference can supply up to 0.1 ma of current to power external circuitry. st52x301 includes an 8-bit sampling analog to digital (a/d) converter with a 4 analog channel fast multiplexer (32 m s conversion time/channel). it is possible to perform operations on data stored in the register file (16 bytes), allowing to manage new inputs and feedback outputs. the triac/pwm driver peripheral allows to manage directly power devices, implementing three different operating modes: burst mode (i.e.thermal applications), phase angle partialization (i.e. motors control by triacs) and high frequency pwm controls. a programmable timer with internal prescaler, using both internal or external clock, is available. the microcontroller configuration is stored in the internal eprom. a powerful development environment, fuzzystudio ? 3.0, consisting of a board and software tools, allows an easy configuration and use of st52x301. st52x301 is fully supported by fuzzystudio3.0 software tools allowing to gra ph ic ally d es ig n a project and obtain an optimized microcode. st52x301 exploits a sgs-thomson patented strategy to store the mfs in its internal memory. oscillato r alu - fuzzy core system registers control unit register file parallel i/o port 2kbytes eprom triac/pwm drive r prog.timer with presc aler sci a/d convert er band-gap reference figure 1. st52x301 architectural block diagram 2/99 st52t301/e301
figure 2. clcc44-w pin configuration figure 3. plcc44 pin configuration 3/99 st52t301/e301
pin name type programming phase working phase 1 not connected - - 2 av dd analog v dd analog v dd 3 av ss analog ground analog ground 4 ev dd eprom digital power supply eprom digital power supply 5 ev ss eprom digital ground eprom digital ground 6 v pp eprom programming power supply (12v 5%) eprom v dd (5v 10%) 7 v dd digital power supply digital power supply 8 v ss digital ground digital ground 9 p0 i/o i/o eprom data digital i/o 10 p1 i/o i/o eprom data digital i/o 11 p2 i/o i/o eprom data digital i/o 12 p3 i/o i/o eprom data digital i/o 13 p4 i/o i/o eprom data digital i/o 14 p5 i/o i/o eprom data digital i/o 15 p6 i/o i/o eprom data digital i/o 16 p7 i/o i/o eprom data digital i/o 17 ready o i/o port handshaking signal 18 p8 o digital output 19 test i (must be set to 0) (must be set to 0) 20 main2 i/o zero crossing/prescaler output 21 main1 i zero crossing 22 v dd digital power supply digital power supply 23 v ss digital ground digital ground 24 triacout o triac/pwm driver output pulses 25 mode i functionment mode selector functionment mode selector 26 reset i general reset general reset 27 ce/int i chip enable eprom external interrupt 28 timerout o output timer 29 eres / tres i eprom address counter reset external timer reset 30 oe / tctrl i eprom output enable timer start/stop signal 31 oscout i/o oscillator output oscillator output 32 oscin i oscillator input oscillator input 33 cadd / tclk i eprom change address clock timer external clock 34 v ss digital ground digital ground 35 v dd digital power supply digital power supply 36 txd o sci output 37 rxd i sci input 38 not connected - - 39 not connected - - 40 ain3 ainp analog input 41 ain2 ainp analog input 42 ain1 ainp analog input 43 ain0 ainp analog input 44 bg aout band gap output table 1. plcc44 and clcc44-w pin configuration 4/99 st52t301/e301
1.2 pin description v dd, ev dd, v ss , ev ss, av dd ,av ss, v pp . in order to avoid noise disturbances, the power supply of the digital part is kept separated from the power supply of the analog part. v dd. main power supply voltage (5v 10%). v ss . digital circuit ground. ev dd. eprom main power supply voltage (5v 10%). ev ss . eprom digital circuit ground. av dd . analog v dd of the analog to digital converter. av ss .analogv ss of theanalogto digitalconverter. must be tied to v ss . v pp . main power supply for the internal eprom (12.5v 5%). oscin and oscout. these pins are internally connected with the on-chip oscillator circuit. a quar tz crystal or a ceramic resonator can be connectedbetween these two pins in order to allow the correct operations of st52x301 with various stability/cost trade-offs. an external clock signal can be applied to oscin, in this case oscout must be grounded. reset . this signal is used to restart st52x301 at the beginningof its program.it also allows to select the program mode for the eprom. int . external interrupt active on rising or falling edge. ain0-ain3. these 4 lines are connected to the inputs of the analog multiplexer. they allow to acquire 4 analog inputs. bg . a voltage equal to 2.5v is available on this pin. it can be used for analog signal conditioning. p0-p7 . these 8 lines are organizedas one i/o port. during the programming phase such port is used for the eprom data read/write. ready . handshake signal of the parallel port. p8 . digital output. txd . serial data output of the sci transmitter block. rxd . serial data input of the sci receiver block. tres , tclk , tctrl , timerout . these pins are related with the internal programmable timer. the timer can be reset externally by using tres. in working mode, tres resets the address counter of the timer. tres is active at low level the timer clock can be the internal clock or can be supplied externally by using the pin tclk. an external start/stopsignal can be used to control the timer throughthe pin tctrl.the timeroutput is available on the pin timerout. main1 , main2 , triacout . st52x301 is able to drive a triac in two different modes: burst mode or phase angle partialization control mode. the burst mode is used for thermal regulation. main1 and main2 signals are used to detect the zero crossing of the main voltage. thepulse to drivethe triacis givenby triacout pin. it is possible to use the same pins to implement a pwm driver. in this case it is possible to fix the period of pwm and to change the duty cycle on fly. the pwm output is given by triacout pin. ce , oe , eres , cadd , v pp . these pins are used to manage the eprom during the programming phase. during the programming phase (programming) v pp must be set at 12v. in the working phase v pp must be equal to v dd . eres in programming mode resets the address counter of the eprom; it is active at high level. in the working phase oe, ce and cadd are used like handshaking signals for the parallel port. mode . it selects the functionment mode (programming or working mode). test . it enables the testing functionalities; during the programming and working phaseit must be set to 0. 5/99 st52t301/e301
2 internal architecture st52x301 is made up by the following blocks and peripherals: control unit fuzzy core alu eprom clock oscillator analog multiplexer and a/d converter prescaler timer bandgap triac / pwm driver digital i/o port serial communication interface st52x301 operating modes st52x301 works in two modes, programming and working modes, depending on the control signals level reset, test and mode. the operating modes are selected by setting the control signal level as specified in the control signals setting table. 2.1 control unit the control unit (cu) manages: registers file, input registers, configuration registers, alu, accumulator and multiplexer inputs. moreover the cu drives the fuzzy core and the peripherals (triac/pwm driver and timer). the cu reads the stored instructions on the eprom (fetch) and decodifies them. if the instructions are arithmetic or logic, the cu runs them directly, sending the control signals to the related blocks. if there is a stop instruction, the cu transfers the control to the fuzzy core. the fuzzy core (fc) will read the next instruction (that must be a fuzzy instruction)from the eprom. the fc mantains the control of the program until the next stop instruction. then the fc transfers the control to the cu. these characteristicsallow to mix fuzzy algorithms with mathematical and logic instructions. figure 2.1 shows a flow-chart reasuming the logic behaviour of the instructions management. control signal programming reset working reset 001 test 000 mode 100 table 2.1. control signals setting cu reads fromthe eprom and decodifies the instruction cu executes instruction fuzzy core reads fromthe eprom and decodifies the instruction stop? stop? no no fuzzy core executes instruction yes yes figure 2.1. computation algorithm flow chart 6/99 st52t301/e301
8 bit a/d converter eprom 2 kbytes timer tres tclk timerout fuzzy core i/o parallel port p0..p7 ain0..ain3 pow er supply oscillator reset triac/pwm driver main1 main2 triacout control unit reset oscin vss vdd alu pc register file input registers inp_port sci_in sci_st fuzzy_out_0 fuzzy_out_1 adc_out_0 adc_out_1 adc_out_2 adc_out_3 tmr_out tmr_adc_st vpp reg 0 reg 15 reg 1 reg_conf0 reg_conf15 reg_conf1 configuration registers sci (uart) txd tctrl rxd fl ags p8 ready oscout peripheral register periph_reg_0 periph_reg_1 periph_reg_2 figure 2.2. st52x301 block diagram 7/99 st52t301/e301
it is not possibile to stop the fuzzy inference before the end of the defuzzificationof one output.aset of 26 different arithmetic and logic instructions is available.each instruction requiresfrom4 to7 clock pulses to be performed. 2.1.1 program counter the program counter (pc) is a 11-bit register that contains the address of the next memory location to be processed by the core.this memory location may be an opcode,an operand or an address of an operand. the 11-bit length allows the direct addressing mode of 2048 bytes in the program space. after having read the current instruction address, the pc value is incremented. to execute relative jumps the pc and the offset are shifted through the fuzzy core or the alu, where they will be added. the result of this operation is shifted back into the pc. the pc can be changed in the following ways: jp (jump) instruction pc = jump address interrupt pc = interrupt vector reti instruction pc = pop (stack) reset pc = reset vector normal instruction pc = pc + 1 2.1.2 flags the st52x301 core includes two pairs of flags that correspond to 2 different modes: normal mode and interrupt mode. each pair consist of a carry flag and a zero flag. one pair (cn, zn) is used during normal operation and one is used during the interrupt mode (ci, zi). the st52x301 core uses the pair of flags that correspond to the actual mode: as soon as an interrupt is generated,the st52x301 core uses the interrupt flagsinstead of the normal flags.when the reti instruction is executed the normal flags are restored if the mcu was in the normal mode before the interrupt. it should be observed that each flag set can only be addressed in its own routine. the flags are not cleared during the context switching and remain in the state they were at the exit of the last routine switching. the carry flag is set when a carry or a borrow occurs during arithmetic operations, otherwise it is cleared. the switching between the two sets of flags is automatically performed when an interrupt or a reti instruction occur. 2.2 address spaces w.a.r.p3tc has four separate address spaces: register file: 16 8-bit registers input registers:11 8-bit registers configuration registers: 16 8-bit registers peripheral registers: 3 8-bit registers program memory up to 2k bytes the program memory will be described in further detail in the memorysection 2.2.1 register file the register file (rf) consists of 16 general purpose 8-bit registers reg0 to reg15. all the registers in the rf can be specifiedby using a decimal address, e.g. 0 identify the first register of the rf, called reg0. reg0:3 are directly connected to the fc input. it means that the input values of the fuzzy algorithm must be loaded into these registers by the user. these registers are used as temporary registers during the macros' computation. 8/99 st52t301/e301
input registers alu ldri r egister file fuzzy core ldpr ldrr ldrc ldcf core on-chip peripherals p eripheral r egisters configuration registers program memory peripheral block ldcf cri, x (1 ) figure 2.3. address spaces description register file reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 reg10 reg11 reg12 reg13 reg14 reg15 fuzzy_in_0 fuzzy_in_1 fuzzy_in_2 fuzzy_in_3 free free free free free free free free free free fuzzy core register description free free figure 2.4. register file description 9/99 st52t301/e301
figure 2.5. input registers bench description 2.2.2 input registers bench the input registers (ir) bench consists of 11 8-bit registers containing data or status of the peripherals. all the registers can be specifiedby using a decimal address, e.g. 0 identifies the first register of the ir. the first four registers (adc_out_0:3) of the ir are dedicated to the 4 converted values coming from the adc. tmr_out registers contains the current counted value by the internal timer; whereas tmr_st is the timer status. for details about tmr_st, please refer to timer description. data read by the parallel i/o port are stored automatically in the 6-th register, inp_port. data read by the sci are stored automatically in the 7-th register sci_in and sci status is stored in the sci_st register. for details about sci_st, please refer to sci description. the fuzzy core writes the computed output values in the fuzzy_out_0:1 registers. 10/99 st52t301/e301
figure 2.6. tmr_adc_st registers figure 2.7. sci_st registers 11/99 st52t301/e301
2.2.3 configuration registers the st52x301 setting permits to configure all blocks.table 2.2 describesthe relatedblock to each bit of the configuration registers. use and meaning of each register will be described in further details in the corresponding section. register peripheral bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 reg_conf0 parallel port io7 io6 io5 io4 io3 io2 io1 io0 reg_conf1 sci, core, i/o port rdrf ovr brk tdre txc eckf p8 out reg_conf2 adc not used iadd 1 adrst reg_conf3 sci brsl t8 m re te reg_conf4 timer tmlsb reg_conf5 timer tmmsb reg_conf6 timer not used pol tms cksl tmel iesl tmst tmrst reg_conf7 timer not used fzsl inpsl intr intf intsl reg_conf8 triac tclsb reg_conf9 triac tcmsb reg_conf10 triac iosl psf cksl mode tcst tcrst reg_conf11 triac intsl tcmsk tctrs pol reg_conf12 triac fzsl inpsl utpmsb reg_conf13 triac utplsb reg_conf14 interrupt exti not used msktc msktm msksci mskad mske reg_conf15 interrupt int4 int3 int2 int1 table 2.2. configuration registers description 12/99 st52t301/e301
2.2.4 peripheral registers periph eral registers contain the initialization values for the timer, triac/pwm driver and parallel port. the peripheral initialization value is kept from a location of the register file, by using a ldpr instruction, or from fuzzy_out_0/1 input register according with the related configuration registers. table 2.3 describes the related peripheral to each configuration register. use and meaning of each register will be described in further details in the corresponding section. peripheral register peripheral periph_reg_0 timer periph_reg_1 triac/pwm driver periph_reg_2 parallel port table 2.3. peripheral register description 13/99 st52t301/e301
2.4 fuzzy core st52x301 fuzzy core main features are: up to 4 inputs with 8-bit resolution up to 16 membership functions (mbfs) for each input (64 possible mbfs) up to 2 outputs with 8-bit resolution possibility to process fuzzy rules with a max. number of 8 antecedents 2.4.1 internal structure the block diagram shown in figure 2.9 describes the structure of st52x301fuzzy core.in this figure we can distinguishdifferentfunctionalblocks:alpha calculator, inference unit and defuzzifier. these blocks allow to perform a mamdani type fuzzy inference with crisp consequents.it is important to underline that the fuzzy inference is performed by using as inputs the first 4 locationsof the registers file. 2.4.2 alpha calculator unit this block performs the intersection (alpha weight) between the input values and the related mbfs (fig. 2.8). 1 input value a ij j-th mbf i-th input variable figure 2.8. alpha weigth calculation figure 2.9. fuzzy core block diagram notice that the inputs for this block come from the first four locations of the register file; it means the user, to evaluate a fuzzy function, must load the input values in these registers. alpha calculator performs what is called fuzzification : the input data are transformed in activation level (alpha weight) of the mbfs. 14/99 st52t301/e301
2.4.3 inference unit it managesthe alphaweights obtainedby the alpha calculator unit to compute the truth value ( w ) for each rule. this is a calculation of the maximum (for the or operator) and/or minimum (for the and operator) performed on alpha values according to the logical connectives of fuzzy rules. it is possibile to link together up to eight conditions by linguistic connectives and/or, not operator and brackets. each rule can have at maximum 8 alpha weights (however they are connected). the truth value w and the related output singleton are passed to the defuzzifier to complete the inference calculation. input 1 x1 a 1 input 2 x2 a2 or = max if input 1 is x1 or input 2 is x2 then ....... input 1 x1 a 1 input 2 x2 a2 if input 1 is x1 and input 2 is x2 then ....... figure 2.10. 2.4.4 defuzzifier this block consists of a multiplier, two adders and one divider. it generates the output crisp values implementing the consequent part of the rules. in this phase each consequent singleton x i is multiplied by its weight values w i , calculated by the inference unit in order to compute the upper part of the defuzzification. each output value (fuzzy_out0, fuzzy_out1) is deduced from the consequent crisp values (x i ) by using the defuzzification formula: y i = x ij w ij j n w ij j n where: i = 0,1 identifies the current output variable n = number of the active rules on the current output w ij =weigth of the j-th singleton xij = abscissa of the j-th singleton the two fuzzy outputs are stored in the location 9 and 10 of the input registers (fuzzy_out_0, fuzzy_out_1). 1 i-th output variable 0 x ij x i0 x in w i0 w ij w in j-th singleton figure 2.11. 15/99 st52t301/e301
2.4.5 input membership function st52x301 allows to manage triangular mbfs. in order to define a mbf it is necessary to store three different data on the memory: the vertex of the mbf: v ; the lenght of the left semi-base: lvd ; the lenght of the right semi-base: rvd ; in order to reduce the dimension of the memory area and the computational effort the vertical dimension of the vertex is fixed to 15 (4 bits) by using the previous memorization method it is possible to store different kinds of triangular memberships functions. in the following figure is shown a typical example of mbfs that can be defined in st52x301 each mbf is then defined storing 3 bytes. to store all the information related with the fuzzy project mbfs, it is necessary to use 192 bytes of the memory (3 bytes*16 mbfs*4 inputs = 192 bytes). x 15 lvd rvd v 15 0 0 input mbf output singleton output variable input variable w figure 2.12. mbfs parameters figure 2.13. example of valid mbfs the mbf is memorized by using the following instruction: data n m lvd v rvd where n identifies the input, m identifies the mbf among the 16 possiblembfs, lvd, v, rvd are the parameters describing the mbf's shape. 2.4.6 output singleton st52x301uses for the output variables a particular kind of membership function called singleton. a singleton has not a shape, like a traditional mbf, and it is characterized by a single point identified by the couple (x, w ), where the w is calculated by the inference unit as described before. often a singleton is simply identified with its crisp value x. 16/99 st52t301/e301
2.4.7 fuzzy rules. the rules can have the following structures: if a op b op c...........thenz if (a op b) op ( c op d op e...) ...........thenz where op is one of the possible linguistic operators (and/or) in the first case the rule operators are managed sequentially; in the second one, the priority of the operator is fixed by the brakets. each rule is codified by using an istruction set, the inference time for a rule with 4 antecedents and 1 consequent is about 3 microseconds. the assembler instruction set allowing to manage the fuzzy instructions are reported in the following table: instruction description data n m lvd v rvd stores the mbf m of the input n with the shape identified by the parameters lvd, v and rvd. ldp n m fixes the alpha value of the input n with the mbf m and stores it in the data stack. ldn n m calculates the negated alpha value of the input n with the mbf m and store the result in the data stack. fzand implements the fuzzy operation and between the last two values stored in the data stack. fzor implements the fuzzy operation or between the last two values stored in the data stack. ldk stores the result of the last fuzzy operation executed in the data stack. skm stores the result of the last fuzzy operation executed in the memory register m. ldm copies the value of the register m in the data stack. con crisp multiplies the crisp value with the last w weight. out n_out performs the defuzzification. stop ends the fuzzy algorithm. table 2.4. fuzzy instructions set 17/99 st52t301/e301
example 1: if input 1 is not mbf 1 and input 4 is mbf 12 or input 3 is mbf 8 then crisp 1 is codified by the following instructions ldn 1 1 calculates the not a value of input 1 with mbf 1 and stores the result in the data stack ldp 4 12 fixes the a value of input 4 with m 12 and stores the result in the data stack fzand adds the not a and a values obtained with the operations ldn1 1 and ldp 4 12 ldk stores the result of the operation fzand in the data stack ldp 3 8 fixes the a value of input 3 with mbf 8 and stores the result in the data stack fzor implements the operation or between the results obtained with the operations ldk and ldp con crisp 1 multiplies the result of the last w operation with the crisp value crisp 1 example 2, the priority of the operator is fixed by the brakets: if (input 3 is mbf 1 and input 4 is not mbf 15 ) or (input 1 is mbf 6 or input 6 is not mbf 14 ) then crisp 2 ldp 3 1 fixes the a value of input 3 with mbf 1 and stores the result in the data stack ldn 4 15 calculates the not a value of input 4 with mbf 15 and stores the result in the data stack fzand adds not a and a values obtained with the operations ldp 3 1 and ldn 4 15 skm stores the result of the operation fzand in the memory register m ldp 1 6 fixes the a value of input 1 with mbf 6 and stores the result in the data stack ldn 2 14 calculates the not a value of input 6 with mbf 14 and stores the result in the data stack fzor implements the operation or between the a and not a values obtained with the two previous operations (ldp 1 6 and ldn 2 14) ldk stores the result of the operation or in the data stack ldm copies the value of the memory register m in the data stack fzor implements the operation or between the last two values stored in the data stack (ldk and ldm) con crips 2 multiplies the result of the last w operation with the crisp value crip 2 at the end of the fuzzy rules set a byte, to identify the output involved in the rules, and the stop istruction must be inserted. when the stop instruction is performed, the control of the algorithm goes back to the cu. 18/99 st52t301/e301
2.5 arithmetic logic unit the 8-bit arithmetic logic unit (alu) allows to perform arithmetic calculations and logic instructions which can be divided into 4 groups: load, arithmetic, jump and program control instructions (refer to the st52x301 assembler set for further details ). load instructions menmonic instruction bytes cycles z s ldcf ldcf conf, const 2 6 - - ldrc ldrc reg, const 2 6 - - ldri ldri reg, inp 2 6 - - ldpr ldpr per, reg 1 6 - - ldrr ldrr regi, regj 2 6 - - arithmetic instructions mnemonic instruction bytes cycles z s add add regi, regj 2 7 i i and and regi, regj 2 7 i - sub sub regi, regj 2 7 i i subo subo regi, regj 2 7 i i jump instructions mnemonic instruction bytes cycles z s jp jp addr 2 6 - - jpns jpns addr 2 6 - - jpnz jpnz addr 2 6 - - jps jps addr 2 6 - - jpz jpz addr 2 6 - - sci instructions mnemonic instruction bytes cycles z s srx srx regi 2 5 - - stx stx regi 2 5 - - notes: i affected - not affected table 2.5. arithmetic & logic instructions set the computational time required for each instruction consists of one clock pulse for each cycle plus 3 clock pulses for the decoding phase. 19/99 st52t301/e301
program control instructions mnemonic instruction bytes cycles z s reti reti 1 5 i i rint rint int 1 4 - - stop stop 1 4 - - waiti waiti 1 4 - - udgi udgi 1 4 - - uegi uegi 1 4 - - mdgi mdgi 1 4 - - megi megi 1 4 - - irq irq int label 2 6 - - irqm irqm mask 2 6 - - irqp irqp cost 2 6 - - notes: i affected - not affected table 2.6. arithmetic & logic instructions set (continue) 20/99 st52t301/e301
3 eprom the eprom memory provides an on-chip user-programmable non-volatile memory, that allows fast and reliable storage of user data. there are 16k bits of memory space with an 8-bit internal parallelism (2kbytes) addressed by an 11-bit bus. the data bus is of 8 bits. the memory has a double supply: v pp is equal to 12v 5% in programming phase and 5v 10% during working phase.v dd is equal to 5v 10%. the eprom memory of st52x301 is divided in three main blocks (see figure 3.1): mbfs setting with (0 through 191) contains the coordinates of the vertexes of every mbf defined in the program. interrupt vectors (192 through 201) contain the addresses for the interrupt routines. each address is composed of two bytes. program instruction set (202 through 2048) contains the instruction set of the user program. it can be composed of more boolean and fuzzy algorithms the operation that can be performed, during programming phase, on the eprom are: writing, verify, writing inhibit, standby and erasing. figure 3.2 shows the signals timing in programming mode. 0 192 191 202 201 2048 mbfs setting interrupt vectors program instructionsset boolean algorithm boolean algorithm fuzzy algorithm fuzzy algorithm int_ext int_triac int_timer int_sci int_adc mbf parameters figure 3.1. memory map 3.1 eprom programming phase procedure programming mode is selected by applying 12v 5% voltage to the v pp pin and set the control signal as following: reset: 0, test: 0, mode: 1. cadd, eres, oe and ce are the control signals used during the programming mode. cadd is active on edge, the others are active on level (oe, ce are active low, eres is active high). 3.1.1 eprom writing when the memory is blank, all the bits are at logic level o1o. the data are introduced by programming only the zeros in the desired memory location; however all input data must contain both o1o and o0o. the only way to change o0o into o1o is to erase the whole memory ( by exposure to ultra violet light) and reprogram it. the memory is in writing mode when: ce = low oe = high with stable data on the data bus p(0:7). the total programming pulse width (ce = 0 v) is, typically, 50 m s (by means of 5 pulses of 10 m s), but beforeactivating such pulse, it is suggested to wait for at least 2 m s after v pp rises at 12 v . after the disactivation of the pulse it is suggested to wait for 21/99 st52t301/e301
at least 2 m s before updating the data and the address. the data updating for the next programming is performed, directly by the user, on the data bus p(0:7) while the address is incremented through the pin cadd. 3.1.2 eprom verify a verify mode is available in order to verify the correctness of the data written. it is possible to activate the verify mode immediately after the writing of each byte: ce = high oe = low then, if any error in writing occured, the user has to repeat the eprom writing. the data, during this phase, are avalaible on the bus p(0:7) 3.1.3 writing inhibit it occurs between the writing and verify mode: ce = high oe = high 3.1.4 standby mode the eprom has a standby mode which reduces the active current from 10ma (programming mode) to less than 100 m a. the memory is placed in standby mode by setting ce at high logic level (v pp might be equal to 5 v too). when in standby mode, the outputs are in high impedance state. 3.2 eprom erasure thanks to the transparent window present in the clcc44-w package, its memory contents may be erased by exposure to uv light. erasure begins when the device is exposed to light with a wavelengthshorter than 4000?.it should be noted that sunlight, as well as some types of artificial light, includes wavelengths in the 3000-4000? range which, on prolonged exposure, can cause erasure of memory contents. it is thus recommended that eprom devices be fitted with an opaque label over the window area in order to prevent unintentional erasure. the recommended erasure procedure for eprom devices consists of exposureto short wave uv light having a wavelength of 2537?. the minimum recommended integrated dose (intensity x expo-sure time) for complete erasure is 15wsec/cm 2 . this is equivalent to an erasure time of 15-20 minutes using a uv source having an intensity of 12mw/cm 2 at a distance of 25mm (1 inch) from the device window. oe p(0:7) data in vpp 5v 12v ce inhibit min 2us 2us typ. data out reset cadd writing verify eres input port 50us typ. output port 3us min. figure 3.2. eprom programming timing 22/99 st52t301/e301
4 interrupts the control unit (cu) responds to peripheral events and external events through its interrupt channels. when such an event occurs, if it is not masked and according to a priority order, the current program execution can be suspended to allow the cu to execute a specific response routine. each interrupt is associated with an interrupt vector that contains the memory address of the related interrupt service routine. each vector is located in the program space (eprom memory) at a fixed address (see interrupt vectors table fig. 4.2). 4.1 interrupt functionment if, at the end of an arithmetic or logic instruction, there are pending interrupts, the one with the highest priority is passed. to pass an interrupt means to store the arithmetic flags and the current pc in the stack and execute the associated interrupt routine, whose address is located in one of the eprom memory location between address 192 and 201. the interruptroutine is performedas a normal code checking, at the end of each instruction, if a higher priority interrupt has to be passed. an interrupt request with the higher priority stops the lower priority interrupt. the program counter and the arithmetic flags are stored in the stack. with the instruction reti (return from interrupt) the arithmetic flags and program counter (pc) are restored from the top of the stack.this stack, used for the interrupt priority, is a lifo queue. an interrupt request cannot stop the processing of the fuzzy rules but this is passed only after the definitionof the fuzzy output or at the end of a logic or arithmetic instruction. 4.2 global interrupt request enabling when an interrupt occurs, it generates a global interrupt pending (gip), that can be hanged up by software. after a gip a global interrupt request (gir) will be generate and interrupt service routine associated to the interrupt with higher priority will start. in order to avoid possible conflicts between interrupt masking set in the main program or inside macros, the gip is hanged up through the user global interrup mask or the macro global interrup mask (see fig.4.3). uegi/udgi instruction switches on/off the user globalinterrup mask enabling/disablingthe gir for the main program. megi/mdgi instructions set the macro global interrupt mask in order to assure that the macro will not be broken. normal program flow interrupt service routine reti instruction interrupt figure 4.1. interrupt flow interrupt vectors int_timer 198 196 200 199 197 195 194 193 192 191 int_sci int_adc int_triac int_ext 202 201 figure 4.2. interrupt vectors mapping global interrupt pending user global interrupt mask macro global interrupt mask global interrupt request figure 4.3. global interrupt request generation 23/99 st52t301/e301
4.3 interrupt sources st52x301manages interrupt signals generated by the internal peripherals (timer, triac/pwm driver,analog to digital converter and serial communication port) or coming from the int pin. the polarity of the external interrupt is programmed by the exti bit of the reg_conf14 (see table 4.1 and fig. 4.4). exti=0 means that int_ext is active on rising edge, otherwise it is active on falling edge. each peripheral can be programmed in order to generate the associate interrupt;further detailsare described in the related chapter. 4.4 interrupt maskability the interrupts can be masked by configuring the reg_conf14. the interrupt is enabled when the bit associated to the mask interrupt is o1o. viceversa, when the bit is o0o, the interrupt is masked and is kept pendent. for example ldcf 14, 6 (conf_reg14 =00000110) enables interrupts coming from the adc (int_adc) and from the sci (int_sci). 4.5 interrupt priority six priority levels are available: level 5 has the lowest priority, level 0 has the highest priority. level 5 is associated to the main program, levels 4 to 1 are programmable by means of the priority register called reg_conf15 (see fig.4.5); whereas the higher level is related to the external interrupt (int_ext). timer, triac/pwm driver, sci and adc are identified by a two bits peripheral code (see table 4.2); in order to set the i -th priority level the user must write the peripheral label i in the related int i priority level. bit name value description 0 mske 0 external interrupt masked 1 external interrupt not masked 1 mskad 0 a/d converter interrupt masked 1 a/d converter interrupt not masked 2 msksci 0 sci interrupt masked 1 sci interrupt not masked 3 msktm 0 timer interrupt masked 1 timer interrupt not masked 4 msktc 0 triac/ pwm interrupt masked 1 triac/ pwm interrupt not masked 5 not used - 6 not used - 7 exti 0 active on rising edge 1 active on falling edge table 4.1. configuration register 14 description name description priority peripheral code maskable eprom locations int_ext external interrupt (int) ext highest - yes 200-201 int_adc adc int programmable 00 yes 192-193 int_sci sci int programmable 01 yes 194-195 int_timer timer int programmable 10 yes 196-197 int_triac triac int programmable 11 yes 198-199 table 4.2. interrupts description 24/99 st52t301/e301
d7 d6 d5 d4 d3 d2 d1 d0 reg_conf14 interrupt mske - external interrupt mask mskad - adc interrupt mask exti - external interrupt polarity msksci - sci interrupt mask msktm - timer interrupt mask not used not used msktc - triac interrupt mask figure 4.4. interrupt configuration register 14 d7 d6 d5 d4 d3 d2 d1 d0 reg_conf15 interrupt int1 - high level interrupt int2 - medium-high level interrupt int3 - medium-low level interrupt int4 - low level interrupt figure 4.5. interrupt configuration register 15 25/99 st52t301/e301
i.e. ldcf 15, 201 (reg_conf15=11001001) define the following priority levels: level 1: int_sci(sci code: 01) level 2: int_timer(timer code: 10) level 3: int_adc(adc code: 00) level 4: int_triac(triac code: 11) when a source provides an interrupt request, and the request processing is also enabled, the cu changes the normal sequential flow of a program by transfering programcontrol to a selected service routine. whenan interrupt occurs the cu executes a jump instruction to the address loaded in the related location of the interrupt vector whenthe execution returns to the original program, it begins immediately following the interrupted instruction. 4.6 interrupt reset an eventually pending interrupts can be reset with the instruction rint int i which resets the i -th interrupt bit name value level 0, 1 int1 peripheral code high 2, 3 int2 peripheral code medium-high 4, 5 int3 peripheral code medium-low 6, 7 int4 peripheral code low table 4.3. configuration register 15 description figure 4.6. example of a sequence of interrupt requests 26/99 st52t301/e301
5 clock st52x301 can work by using a 5, 10 or 20 mhz clock. the st52x301 clock generator module generates the internal clock for the internal control unit, alu, fuzzy core and on-chip peripherals and it is designed to require a minimum of external components. the system clock may be generatedby using either a quartz crystal, or a ceramic resonator (ceraloc); or, at least, by means of an external clock. the different clock generator options connection methods are shown in figure 5.1. when an external clock is used, it must be connectedon the pin oscin while oscout must be grounded. the crystal oscillator start-up time is a function of manyvariables:crystal parameters(especially r s ), oscillator load capacitance (cl), ic parameters, ambient temperature, supply voltage. it must be observed that the crystal or ceramic leads and circuit connections must be as short as possible. typical values for cl1, cl2 are 10pf for a 20 mhz crystal. figure 5.1. oscillator connections 27/99 st52t301/e301
6. a/d converter the a/d converter of st52x301 is an 8-bit analog to digital converter with up to 4 analog inputs offering 8 bit resolution with a total accuracy of 2 lsb and a typical conversion time of 32 m s. the conversion range is 0 - 2.5 v. the a/d peripheral converts the input voltage with a process of successive approximations using a fixed clock frequency derived from the oscillator. the adc uses 5 registers: one configuration register, reg_conf2, and four data registers. these 4 registers are the first 4 input registers. the a/d converter drives the analog multiplexer in order to sequentially pick up the external inputs to be put in output and stored automatically in 4 8-bit registers. it is possibile to configurethe multiplexer by means of the register reg_conf2, in order to select the number of analog inputs to convert. for example, if the bit 3 and bit 2 of reg_conf2 are configured at 10, then the multiplexer will sequentially pick up only the inputs 0,1 and 2. table 6.1 shows the convertion sequences according to the possible values of the two bit reg_conf2 (3:2). the a/d converter, at the end of the conversion, will send a signal (end-of-conversion)which can be used like an interrupt signal. the user can select the priority of the a/d interrupt and mask it (see ointerrupt routineo chapter) the conversion starts writing o1o on reg_conf2(0). the a/d is reset by writing o0o in reg_conf2(0). the converted data are automaticallystored in four 8-bit input registers. by performing an instruction: ldri regj ingi the analog input oingio is loadedin the registeroregjo of the register file. figure 6.1. a/d converter structure conf_reg2 (3:2) input sequence 00 ain0 01 ain 0, ain1 10 ain 0, ain 1, ain 2 11 ain 0, ain 1, ain 2, ain 3 table 6.1. 28/99 st52t301/e301
the power consumption of the device can be reduced by turning off the a/d converter, to switch off the a/d converter the conf_reg2(0) bit must be reset to o0o. the a/d converter features a sample and hold. the input voltage ain, which has to be converted must be constant, for 12.8 m s. an internal bandgap reference is available on pin 44, bg. by using this signal as reference for the signal to be converted, the conversion accuracy is not strongly related with the variation of the power supply. the power supply of the a/d converter (av dd and av ss ) in order to avoid interferences is mantained separated from the power supply of the digital core. d7 d6 d5 d4 d3 d2 d1 d0 adc configuration register reg_conf2 reset adc must be 1 adc input selection not used figure 6.2. configuration register reg_conf2 29/99 st52t301/e301
7.timer st52x301 offers one on-chip timer peripheral. thetimer consists of an 8-bit counter with a 16-bit programmable prescaler, thus giving a maximum count of 2 24 , and control logic that allows configuring the functionment and the type of peripheral outputs. figure 7.2 shows the timer block diagram and figure 7.3 shows the internal structure of the timer. the content of the 8-bit counter can be read/written and is incremented on the rising edge of the 16-bit prescaler output (prescout). moreover, it can be read under program control at any instant of the counting phase and loaded in a location of the register file. the prescaler can be given any value between 0 and ffffh setting the 4-th (tmlsb) and 5-th (tmmsb) locations of the configuration registers bench. 7.1 timer functionment the timer requires three signals: tmrclk, trst and tstart (see figure 7.3). each of them can be generated internally or externally, this possibility is programmable by the user. tmrclk increments the counted value of the prescaler. it can be, by setting cksl of reg_conf6 register, the internal clock signal (clkm) or the signal provided on the pin tclk. trst resets to zero the contentof the 8 bit counter. it is generated by the tres or reset external signals or it is forced by tmrstbit of reg_conf6 register. tstart starts/stops the prescaler counting.it can be given on the pin tctrl or it is forced by tmst bit of reg_conf6 register. the tstart signal allows to work in two different modes: level (time counter) : if the tstart signal is high the timer starts the count. when the tstart is low the count is stopped and the current value is stored in the tmr_out register of the input register bench, then it can be transferred to the j-th location of the registers file by using the instruction: ldri reg-j 4 edge(period counter) : after the reset, when the first edge of the tstart signal appears, the timer starts the count, at the next tstart the timer is stopped. in this way it is possible to measure the period of an external signal. the functionment modality is set by the tmel configuration bit of reg_conf6 register. the starting value of the counter can be either a value contained in the register file or directly a fuzzy output. if inpsl (reg_conf7(3)) is set to o1o then the value comes from one of the locations of the register file ( ldrp 0, reg-i); on the contrary it is generated by the fuzzy core. the choice between the two possible fuzzy outputs is set by the fzsl configuration bit of reg_conf6 register fzsl=0/1 means the starting value is the loaded from the fuzzy_out_0/1. level edge start stop start start stop start 00 0 3 3 3 2 1 reset clock counted value figure 7.1. timer functionalities 30/99 st52t301/e301
figure 7.2. timer peripheral block diagram 31/99 st52t301/e301
figure 7.3. timer internal structure 32/99 st52t301/e301
7.2 timer interrupt it is possible to enable the timer interrupt by software control.the timer can be programmed to generate an interrupt request until the end of the count or when there is an external tstart signal. the timer can generate programmable interrupts in to 4 different modes: interrupt mode 1 : interrupt on counter stop. interrupt mode 2 : interrupt on rising edge of timerout. interrupt mode 3 : interrupt on falling edge of timerout. interrupt mode 4 : interrupt on both edges of timerout. in order to program the interrupt mode intsl, intf and intr bits of the reg_conf7 must be set following the indications shown in the table7.1.the timer interrupt can be used to exit the mcu from the wait mode. 7.3 timer configuration the timer configuration needs to set 4 registers of the configuration register bench. conf_reg4: tmlsb contains the less significative bits of the prescaler starting value. conf_reg5: tmmsb contains the more significative bits of the prescaler starting value timer output type 1 type 2 prescout*counter figure 7.4. timerout signal type interrupt mode intsl intf intr 11xx 2 010 3 001 4 011 table 7.1. timer interrupt setting d7 d6 d5 d4 d3 d2 d1 d0 reg_conf4 timer tmlsb - prescaler init value less significative bits d7 d6 d5 d4 d3 d2 d1 d0 reg_conf5 timer tmmsb - prescaler init value more significative bits figure 7.5. timer configuration register 4 and 5 33/99 st52t301/e301
d7 d6 d5 d4 d3 d2 d1 d0 reg_conf6 timer tmrst - internal timer reset tmst - internal timer start not used iesl - internal/external signals selector tmel - edge/level timer abilitation tms - timer output shape pol - timer output polarity cksl - internal/external clock select figure 7.6. timer configuration register 6 bit name value description 0 tmrst 0 stop 1 start 1 tmst 0 stop 1 start 2 iesl 0 internal signals 1 external signals 3 tmel 0 on edge 1 on level 4 cksl 0 internal timer clock 1 external timer clock 5tms 0 pulse wave (type 2) 1 square wave (type 1) 6 pol 0 positive polarity 1 negative polarity 7 not used - table 7.2. configuration register 6 description conf_reg6: tmrst sets the internal inr signal. tmst sets the internal ins signal. iesl selects the source of the tres and tstart signals. iesl=o0o signals are the internal inr and ins. iesl=o1o signals come from the tres and tctrl pins. tmel selects the tstart signal allowing to work in level mode or in edge mode like previously described. tmel=o0o means edge mode tmel=o1o means level mode. cksl selects the source of the tmrclk (work- ing timer frequency). cksl=o0o, the tmrclk is the internal mclk divided by the prescaler starting value. cksl=o1o, the tmrclk is an external clock by tclk pin. tms timerout is a signal with frequency equal to the working timer frequency divided by the starting value of the pres- caler (16 bit) and counter (8 bit). the timer output can be eithera square wave with duty-cycle 50% or a pulse signal (with the pulse durationequal to the pres- caler output signal period). tms=o1o, timerout is a square wave tms= o0o, timerout is a pulse signal. pol defines the polarity of the timer output signal (timerout). 34/99 st52t301/e301
bit name value description 0 intsl 0 int_tmr on falling edge of counter stop 1 int_tmr on edges of timerout 1 intf 0 no int_tmr on falling edge of timerout 1 int_tmr on falling edge of timerout 2 intr 0 no int_tmr on rising edge of timerout 1 int_tmr on rising edge of timerout 3 inpsl 0 timer data input coming from the fuzzy core 1 timer data input coming from a register file location 4 fzsl 0 timer data input coming from fuzzy_out_0 1 timer data input coming from fuzzy_out_1 5 not used - 6 not used - 7 not used - table 7.3. configuration register 7 description d7 d6 d5 d4 d3 d2 d1 d0 reg_conf7 timer intsl - interrupt generator selector intf - interrupt on timerout falling edge intr - interrupt on timerout rising edge inpsl - input data selector fzsl - fuzzy input selector not used not used not used figure 7.7. timer configuration register 7 conf_reg7: intsl it allows to select the interrupt mode for the timer. intsl=o0o interrupt is generated on the falling edge of the counter stop. intsl=o1o the interrupt is generated on the edges of timerout. intf intr inpsl selects the source of the value of the counter between a location of the regis- ter file and the fuzzy core. inpsl=o0o, counter value coming from the fc. inpsl=o1o, counter value coming from the rf. fzsl fzsl= o0o, the valueof the timercounter is equal to fuzzy_out_0 fzsl= o1o, the valueof the timercounter is equal to fuzzy_out_1 35/99 st52t301/e301
8 i/o port st52x301 is provided with dedicated lines for input/output.these lines, grouped into an 8-bit i/o port p(0:7), can be programmed to provide parallel input/output with a handshake line (ready) to carry data in/out. the i/o port is not able to perform operations on the single bit, and the communication cannot be performed at the same time in input and output. it is possible to program the parallel port direction by using the register reg_conf0 in order to set which bits are in input and which are in output. the port has an internal register (periph_reg_2) dedicated to hold output data coming from the register file through an ldpr instruction. input data are automaticallystored in the in_port register, 6-th location of the input register. p8 pin is a digital output line available directly connected to the out bit of the reg_conf1; then it can be set by using a ldcf instruction. (see table 8.2 and figure 8.8) periph_reg_2(i) p(0:7) i/o pin ttl cmos io(i) inp_port(i) tristate reg_conf0(i) p8 output pin reg_conf1(0) out figure 8.1. figure 8.2. 36/99 st52t301/e301
8.1 i/o port configuration reg_conf0 allows dynamic change in i/o port configurationduring program execution setting the communication direction of each bit. ioi setting equal to o0o configures the i-th bit of the p(0:7) i/o port in input. data com- ing from external digital devices are stored in the 6-th location (inp_port)of the input register bench. ioi=o1o sets the i-th bit of the port in output. data stored in the i-th location of the register file is written on the port by using the instruction: ldpr 2, regi bit name value description 0 io0 0 input pin 1 output pin 1 io1 0 input pin 1 output pin 2 io2 0 input pin 1 output pin 3 io3 0 input pin 1 output pin 4 io4 0 input pin 1 output pin 5 io5 0 input pin 1 output pin 6 io6 0 input pin 1 output pin 7 io7 0 input pin 1 output pin table 8.1. configuration register 0 setting d7 d6 d5 d4 d3 d2 d1 d0 reg_conf0 i/o port io0 - i/o communication direction bit io1 - i/o communication direction bit io2 - i/o communication direction bit io3 - i/o communication direction bit io4 - i/o communication direction bit io5 - i/o communication direction bit io6 - i/o communication direction bit io7 - i/o communication direction bit figure 8.3. configuration register 0 37/99 st52t301/e301
8.2 input handshake figure 8.5 illustrates the timing associated with the ready handshake signal, when the instruction ldri reg 6 is performed. when the ldri instruction is executed to read the port, st52x301 resets the ready signal to indicate that it is not possible to change the input data during this phase of reading. to synchronizethe transmission with ready signal will prevent the inp_port data from changing while st52x301 is reading the port. read port signal represented in figure 8.5 is an st52x301 internal signal. input data on the port are continuously sampled and are strobed into the port only when ready is set. w.a.r.p.3tc x x x x x x0 x reg_conf1 p(7:0) iop external periphera l data r eady i/o port figure 8.4. one line input handshake pio(7:0) ready data in read port clk new data in figure 8.5. one line input handshake timing 38/99 st52t301/e301
8.3 output handshake figure 8.7 illustrates the timing associated with the ready handshake signal, when the instruction ldpr 2 reg is performed. whenready is reset no significantdata are on the output port pins, because st52x301 is writing into the periph_reg_2. when the data is ready in periph_reg_2, ready signal is set. the rising edge of ready signal can be used as a latching signal. no peripheral acknowledge is waited for. if the signal ready is high, it means that the data out is still not read.in this case, the following ldpr instruction is stored in a one register peripheral stack. if the ready is maintained high, the following ldpr instructions store the data coming from the registers file on the same register stack. figure 8.6. one line output handshake figure 8.7. one line output handshake timing 39/99 st52t301/e301
it means that each ldpr instruction deletesthe old value contained in the parallel port stack register and rewrite a newvalue on the same stack register. only the last ldpr instruction is executed if the ready signal is maintained high during several ldrp instructions. bit name value description 0p8 - digital output bit 1 eckf 00 5 mhz 01 10 mhz 2 10 20 mhz 11 20 mhz 3 txc 0 sci end transmission interrupt disabled 1 sci end transmission interrupt enabled 4 tdre 0 sci transmission data register empty interrupt disabled 1 sci transmission data register empty interrupt enabled 5 brk 0 sci break error interrupt disabled 1 sci break error interrupt enabled 6 ovr 0 sci overrun error interrupt disabled 1 sci overrun error interrupt enabled 7 rdrf 0 sci received data register full interrupt disabled 1 sci received data register fullinterrupt enabled table 8.2 configuration register 1 setting figure 8.8. 40/99 st52t301/e301
9 serial communication interface the serial communication interface (sci) integrated into the fuzzy processor st52x301 provides a general purpose shift register peripheral, that allows to link several widely distributed mcus, through their sci subsystem. the sci gives a serial interface providing communication with common baud rates, up to 38400 hz, and flexible character format. the sci is a full-duplex uart-type asynchronous system with standard non return to zero (nrz) format for the transmitted/received bit. the length of the transmitted word is 10/11 bits (1 start bit, 8/9 data bits, 1 stop bit). the sci is composed of three modules: receiver, transmitter and baud-rate generator and it is configured by means of configuration registers 3 and 1. 9.1 sci receiver block the sci receiver block manages the synchronization of the serial data stream and stores the data characters. the sci receiver is mainly formed by two sub-systems: recovery buffer block and scdr_rx block. the re configuration bit set to o1o (configuration register 3) enables the sci receiver. the sci receives data coming from the rxd pin and drives the recovery buffer block, that is a high-speed shift register operating at a clock frequency (clock_rx) 16 times higher than the fixed baud rate (clock_tx). this sampling rate, higher than the baud rate clock, allows to detect figure 9.1. sci transmitted word structures figure 9.2. sci block diagram 41/99 st52t301/e301
bit name value description 0te 0 transmission disabled 1 transmission enabled 1re 0 receiver disabled 1 receiver enabled 2 m 00 8, no parity, 1 bit stop 01 8, no parity, 2 bit stop 3 10 8, parity, 1 bit stop 11 9, no parity, 1 bit stop 4t8 0 parity odd, if parity is selected (m = 10); otherwise 9th data bit 1 parity even, if parity is selected (m = 10); otherwise 9th data bit 5 brsl 000 600 hz 001 1200 hz 010 2400 hz 6 011 4800 hz 100 9600 hz 101 19200 hz 7 110 38400 hz 111 external clock table 9.1 configuration register 3 setting the start condition,the noise errorand the frame error. when the sci receiver is in idle status, it is waiting for the start condition, that is obtained with a logic level 0, consecutive to a logic level 1. this conditionis detected,if,with thefixed sampling time, three logic levels 0 are sampled after three logic levels 1. the recognition of the start bit forces the sci receiver block to enter in an data acquisition sequence, according to serial mode. the 2 bits, m, of the configurationregister 3 allow to definethe serial mode with the conventionshown in table 9.2. the bit, t8, in caseof m = 10 is used to set the parity check to perform, as indicated in the previous table 9.2. the recognition of stop condition allows to transfer the received data, from recovery bufferto scdr_rx buffer, adding the eventual ninth data bit, according to the meaning shown in the previous table 9.2. after this operation, rxf flag of sci status input register 8 (fig. 9.3) is set to logic level 1. the control unit reads the data from scdr_rx buffer (in read-only mode) with srx instruction and provides a reset at logic level 0 to rdrf flag. if a data of recovery buffer is ready to be transferred into scdr_rx buffer, but the previous one was not yet read by the core, an overrun error takes place: the status flag overr indicates the error condition. in this case the information stored in scdr_rx buffer is not altered, but the one that has caused the overrun error can be overwritten by a new data coming from the serial data line. recovery buffer block this block is structured as a synchronised finite state machine on the clock_rx signal falling edge. when the recovery buffer block is in idle state it waits for the reception of the correct 1 and 0 sequence representing the start. the recognition takes place by sampling the input rxd at clock_rx frequency, that has a frequency 16 times higher than clock_tx. for this reason, while the external transmitter sends a single bit, the recovery buffer block samples 16 states (from sample1 to sample16). 42/99 st52t301/e301
bit name value description 0p8 - digital output bit 1 eckf 00 5 mhz 01 10 mhz 2 10 20 mhz 11 20 mhz 3 txc 0 sci end transmission interrupt disabled 1 sci end transmission interrupt enabled 4 tdre 0 sci transmission data register empty interrupt disabled 1 sci transmission data register empty interrupt enabled 5 brk 0 sci break error interrupt disabled 1 sci break error interrupt enabled 6 ovr 0 sci overrun error interrupt disabled 1 sci overrun error interrupt enabled 7 rdrf 0 sci received data register full interrupt disabled 1 sci received data register fullinterrupt enabled table 9.2 configuration register 1 setting the analysis of rxd input signal is carried out looking three samples for each bits received.0 if these three samples are not equal, then the noise error flag, nserr, of input register 8 is set to 1 and the received data value will be the one assumed by the majority of the samples. by means of the procedure described above, to avoid sci becomes idle, because of a limited noise due to an erroneous sampling, the transmissionis recognizedas correct and the noise flag error is set. at the end of the cycle relative to the reception of a bit, recovery buffer block will repeat the same steps 9 times: one step for each received bit, plus one for the stop acquisition(10 times in caseof 9-bit data, double stop or parity check). at the end of datareception,recovery bufferblock, will supply information on eventual frame errors by setting to 1 frerr flag bit of input register 8. a frame error can occur if the parity check has not been successfully achieved or if stop bit has not been detected. if recovery buffer block receives 10 consecutive bits at logic level 0, a break error occurres, and interrupt routine request starts. scdr_rx block it is a finite state machine synchronized with the falling edge of the clock master signal, ckm. the scdr_rx block waits the signal of complete reception, from the recovery buffer, to load the word received. moreover, the scdr_rcx block loads the values of frerr and nserr flag bits (input register 8), and sets the rxf flag to 1. using srx instruction the data are transferred to register file and rxf flag is reset to 0, to indicate scdr_rx block is empty. if a new data arrives before the previous one has been transferred to register file, an overrun error occurres and overr flag, of input register 8, is set to 1. 43/99 st52t301/e301
9.2 sci transmitter block the sci transmitter block consists of the following underblocks: scdr_tx and shift register, synchronized, respectively, with the clock master signal (ckm) and the clock_tx. the whole block receives through configuration register 3 (m bits) the settings for the following transmission modes (see table 9.1): 8-bit word and a single stop signal 8-bit word plus a paritybit and a singlestop signal 8-bit word plus a double stop signal 9-bit word in case of 9 bit frame transmission, the most significative bit arrives through t8 of the configuration register 3. in an 8-bit transmission, instead, t8 is used to configure the sci, according to information containedin m (see table 9.1):in particularto chose the polarity control (even or odds) to implement the parity check. after a reset signal, rst, the scdr_tx block is in idle state until it receivesenabling signal, te=1, of configuration register 3. if te=1, using stx instruction the data, to be transmitted, are transferred from register file to scdr_tx block and the flag of input register 8, txem, is reset to 0, to indicate scdr_tx block is full. if the core supplies a new data, this could not be loaded in the scdr_tx block until the current data has not been unloaded on the shift register block. this means that only when txem is 1, it is possible to load data in the scdr_tx block. when the shift register block loads the data to be transmitted on an internal buffer, txend is reset to 0 to indicate the beginning of a new transmission. at the end of transmission txend is set to 1, allowing to load in the shift register a new data coming from scdr_tx. it is important to underline that txend = 1 does not mean scdr_tx is ready to receivea newdata. for this reason it is better to utilise the txem signal to synchronize the stx instruction to the sci transmitter block if st52x301 core resets te to 0, the transmission is interrupted, but the sci transmitter block completes the transmission in progress before to reset. 9.3 baud rate generator block the baud rate generator block performs the division of the clock master signal (ckm), in a set of synchronism frequencies for the serial bit reception/transmission on the external line. table 9.1. shows the set of frequenciesselected by means of brsl (configuration register 3). reception frequency (clock_rx) is 16 times higher than transmission frequency (clock_tx) . if brsl is equal to 111, clock_rx and clock_tx signals coincide with clock master, ckm. figure 9.3. sci status input register 44/99 st52t301/e301
10 triac/pwm driver st52x301 offers a peripheral able to generate a signal on pin 24, triacout, to drive an external device, like a triac, a igbt or a power mos. triac/pwm driver can perform 3 different working modes according to reg_conf10 bits, mode (see table 10.4): mode = o01o: pwm mode = o10o: burst mode triac control (thermal regulations) note: i n this case cksl of reg_conf10 must be set to o1xo. (see table 10.4) mode = o11o: phase angle partialization triac control (motor control) the triac/pwm driver can be initialized by using a value fixed by a controlalgorithm, that can be either the output of a fuzzy inference or the result of an arithmetic calculus stored in the register file. in the latter case, by using the ldpr 1,reg-i instruction, the value, contained in the i-th register of register file, is stored in the triac driver/pwm peripheral register periph_reg_1. figure 10.1 shows the internal structure of triac/pwm driver. pwm mode the pwm working mode is obtained by setting reg_conf10 bits, mode, at o01o value. it consists of a signal, with fixed period , whose duty cycle can be modified. figure 10.1. triac/pwm driver simplified block diagram 45/99 st52t301/e301
d7 d6 d5 d4 d3 d2 d1 d0 reg_conf8 triac / pwm tclsb - prescaler init value least significative bits d7 d6 d5 d4 d3 d2 d1 d0 reg_conf9 triac / pwm tcmsb - prescaler init value most significative bits figure 10.2. triac/pwm configuration register 8 and 9 the pwm period can be generated, internally, by dividing the master clock or, externally, by using an external clock signal. in both cases, the clock signal is divided by a 16-bit prescaler, managed by reg_conf8 and reg_conf9 (see figure 10.2). the duty cycle is fixedby a value,that can be either the output of a fuzzy inference or the result of an arithmetic calculus. in the first case, it can be loaded directly in the register of the peripheral, otherwise it can be stored in one location of the register file for further manipulations and then used for the control of the pwm. burst mode it is based on turning on and off the triac, for a fixed integer number of main voltage periods, in order to control the power transferred to the load. for this reason a burst mode triac control consists of a signal, with a period, t, containing an integer number of the main voltage periods, whose duty cycle is proportional to the number of periods in which the triac is on (duty cycle). this kind of triac control is mainly used for thermal regulation. theduty cycle is fixedby a valuethat can be directly the output of a fuzzy inference or the result of an arithmetic calculus. in order to work in burst mode, it is necessary to detect the pre-post zero-crossing of main voltage, by using an external inserting circuitry. the user can define the period t, by means of the internal 16-bit prescaler, setting reg_conf8 and reg_conf9 (see figure 10.2).t is proportional to the main voltage period, it is in the range 0 to 21.8 sec (if the main frequency is 50hz). the width and the polarity of the pulses can be programmed according to the triac and the circuit characteristics. phase angle partialization mode this method is based on turning on the triac only for a part (phase angle) of each main voltage period. when the phase angle is large the energy (power)supplied to the load is low, viceversa, when the phase angle is small the energy supplied to the load is high. the phase angle can be fixed by a fuzzy algorithm or by a value stored in the register file. the phase angle is an 8-bit value. the peripheral is programmable in order to work with a main voltage frequency of 50 or 60 hz. 46/99 st52t301/e301
10.1 pwm generator working mode when reg_conf10 (3:2) bits, mode, are o01o, the peripheral is programmed to work in pwm mode. by using the 16-bit prescaler, the pwm period can be generated by dividing the internal master clock, or an external clock signal applied on the pin main1, or the main voltage frequency, by using the circuit shown in figure 10.6. note: the external clock signal, applied on main1 pin, must have a frequency at least three time smaller than the internal master clock. the clock source can be selected by using reg_conf10(5:4)bits, cksl(see table 10.4 and figure 10.9). if the clock source selected is not the main voltage frequency(cksl=1x), main2 pin can be configured as input or output, by using reg_conf10(7) bit, iosl (see table 10.4). if main2 is an output, on this pin it is possible to get the prescaler output signal tck. the period of the pwm signal is obtained by using the following relation: t=256*tck where tck is the output of the 16-bit prescaler managed by reg_conf8 and reg_conf9 (see figure 10.2). note. in pwm working mode, the value n, stored in the 16-bit prescaler, must be in the range from 2 to 2 16 -1 by using a 20 mhz clock master it is possible to obtain a pwm frequency in the range 1.2 hz to 26.04 khz. the value ton is proportional to a value, init_value, that can be a fuzzy output or a value value description 01 pwm driver 10 burst mode control (1) 11 phase angle control note: (1) reg_conf10(5) must be set to o1o table 10.1. mode - triac/pwm working mode settings mclk frequency 1/ t min max 5 mhz 0.3hz 6.51 khz 10 mhz 0.6 hz 13.02 khz 20 mhz 1.2 hz 26.04 khz table 10.2. pwm frequencies t=256*tck ton = init_value* tck toff triacout figure 10.3. pwm functionament coming from register file, according with the inpsl and fzsl configuration bits of reg_conf12 (see table 10.6 and figure 10.12). the ton is equal to: ton= init_value*tck. it means the ton can be fixed by the control algorithm that can be either the output of a fuzzy inference or the result of an arithmetic calculus. in the second case, the data, stored in the i-th location of the register file, can be loaded by using the instruction: ldpr 1, reg-i . if the init_value is 255 the toff is equal to tck. 47/99 st52t301/e301
10.2 burst mode when reg_conf10 (3:2) bits, mode, are o10o the peripheral is programmed to work in burst mode. notice that when you are working in burst mode cksl must be set to o1xo . (see table 10.4) a square wave, tb, is generated with a duty cycle proportional to the power the user intends to transfer on the load. a pulse is generated for each zero crossing of the main voltage included in the ton of the fixed period. figure 10.4 shows the typical burst control working mode.the period t of the signal tb (see figure 10.4) is equal to 256*tck. thesignal tck is generatedprogrammingthe 16-bit prescaler, by reg_conf8 and reg_conf9 (see figure 10.2). tck is equal to the main voltage frequency (50 or 60 hz) divided by n+1, where n value is from 0 to 2 16 -1. the value ton is proportional to a value, init_value, that can be a fuzzy output or a value coming from register file, according with the inpsl and fzsl configuration bits of reg_conf12 (see table 10.6 and figure 10.12). on triacout pin is generated a sequence of pulses, programmed, by using reg_conf11(0) bit, pol (see table 10.5), in order to be positive or negative, to drive the triac in different quadrants. the number of generated pulses, n_pulses, is: n_pulses = 2 [(n+1)*init_value - n] where n is the value stored in the 16-bit pescaler. then ton = (n_pulses / 2)* t power line the first pulse is obtained during the first zero crossing of the main voltage and the last one is generated after init_value*tck clock pulses, where tck is the prescaler output, generated by using the main voltage frequencyapplied to main1 and main2 pins. theperipheral can be programmed in order to work with 50 or 60 hz main voltage frequency, by setting the reg_conf10(6) bit, psf (see table 10.4). ranges of the tb signal period depend on the power line frequency (see table 10.3). in order to drive a triac in burst mode it is required to generate a sequence of pulse, that must be centred on the zero crossing of the power line as shown in the figure 10.7. for this reason, the pre zero crossing and the post zero crossing of the power line must be detected. to detect the zero-crossing and get also the main voltage frequency, the user must generate main1 and main2 signals, by using the circuit shown in figure 10.6. main1 and main2 signals are used in the block called pulse generator of the peripheral (see figure 10.1). in particular the pulses are generated by using the rise edge of the signal main1 and the falling edge of the signal main2. figure 10.5 shows the generation of the triac pulses tp . the first firing pulse for the triac is generated on the zero crossing of the power line, while the next pulses are centred on the zero crossing. power line frequency t min max 50 hz 5.12 s 335544 s 60 hz 4.26 s 279620 s table 10.3. triacout signal period -1.5 -1 -0.5 0 0.5 1 1.5 ton tb power line triacout t = 256 * tck figure 10.4. burst working mode 48/99 st52t301/e301
normally the triac firing pulses start 1/3 tp before the zero crossing and the lengthof the pulses is tp, see figure 10.5. the length tp of the pulses is programmable by using utp value, that is a 14-bits number, obtained with reg_conf12(5:0) bits, utpmsb, and reg_conf13, utplsb (see figure 10.12 and table 10.6): utp(13:0) = [utpmsb(5:0) utplsb(7:0)] t p =t mclk * utp the value tp is in the range 0 to 4.9 ms when the clock master is 20 mhz. according to reg_conf11(0) configuration register bit, pol, it is possible to set the firing (1) (0.5) 0 0.5 1 ig tp negative triac gate current 2/3 tp tp 1/3 tp positive triac gate current power line ig ii and iii quadrants i and iv quadrants figure 10.5. burst mode pulse polarity figure 10.6 burst mode zero crossing circuit main1 main2 -1.5 -1 -0.5 0 0.5 1 1.5 main voltage triacout tp tp tp t mask t mask figure 10.7 burst mode zero crossing mclk frequency t p min max 5 mhz 0.0012 ms 19.6608 ms 10 mhz 0.0006 ms 9.8304 ms 20 mhz 0.0003 ms 4.9152 ms pulses polarity; in order to obtain positive or negative gate triac currents, allowing to work respectively in i and iv quadrants, or in the ii and iii quadrants (see figures 10.5 and 10.12). to increase the immunity of the peripheral against the electrical noise of the main voltage, a programmable masking time, by using reg_conf11(5:2) bits, tcmsk (see table 10.5) 49/99 st52t301/e301
and figure 10.11), is introduced after each firing pulse (see figure 10.7): masking time =(2^tcmsk*200 +100) ns. if tcmsk is 0 then masking time is 0. in fact, to avoid the detection of electrical noise, during the masking time no signal, coming from main1 and main2, is taken into account. working in the ii and iii quadrant the peripheral implements the following procedure: 1) the firing pulse is set to o1o on the rising edge of main1. 2) the firing pulse is reset to o0o after the time tp fixed by program. 3) the firing pulse is reset to o0o for a time equal to the fixed masking time. 4) on the falling edge of main2 the firing pulse is set to o1o 5) the firing pulse is reset to o0o after the time tp fixed by program. 6) the firing pulse is reset to o0o for a time equal to the fixed masking time. following this approach it is possible to filter electrical noise and oscillations on the signal main1 and main2. it is possible to generate a programmable interrupt in four different ways: 1) no interrupt; 2) interrupt on the rising edge of the signal tb. 3) interrupt on the falling edge of the signal tb. 4) interrupt on both the edge of the signal tb. the interrupt is programmable by using the register reg_conf11(7:6), intsl (see table 10.5). (1.5) (1) (0.5) 0 0.5 1 1.5 (1.5) (1) (0.5) 0 0.5 1 1.5 v a2-a1 il 180 360 00 a g phase angle current flow angle l n loa d a2 a1 il figure 10.8. phase angle partialization mode 10.3 phase angle partialization work- ing mode when reg_conf10 (3:2) bits, mode, are o11o the peripheral is programmed to work in phase angle partialization mode. in this mode triac is controlled each period of the main voltage. the power transferred to the load is proportional to the current flow angle g . this kind of triac control is suitable to drive the triac tcmsk maskingtime 0000 0 m s 0001 0.5 m s 0010 0.9 m s 0011 1.7 m s 0100 3.3 m s 0101 6.5 m s 0110 12.9 m s 0111 25.7 m s 1000 51.3 m s 1001 102.5 m s 1010 204.9 m s 1011 409.7 m s 1100 819.3 m s 1101 1638.9 m s 1110 3276.9 m s 1111 6553.7 m s 50/99 st52t301/e301
with inductive load (i.e. universal or monophase motors). in the figure 10.8 is shown the relation between the phase angle a and the current flow angle g . the peripheral allows to control the phase angle or equivalentlythe time t1 (see figure 10.9). it is possibleto changetime t1 settingthe contents of the peripheral register periph_reg_1. this value could be directly loaded by using one of the two fuzzy outputs or by using a value coming from the registers file, according with inpsl and fzsl configurationbits of reg_conf12 (seetable 10.6 and figure 10.13). in order to synchronizethe peripheral with the zero crossing of the main voltage the two pins main1 and main2 must be connected together if the externalcircuit is the one shownin the figure10.10. it is possible to use different circuits for the zero crossing detection, but the main1 signal rising edge must be synchronized with a main voltage zero crossing and the main2 signal falling edge (1.5) (1) (0.5) 0 0.5 1 1.5 mains voltage 10 ms 20 msec t1 t1 tmax 8ms tr tr/2 ti figure 10.9 phase angle partialization mode figure 10.10 phase angle partialization zero crossing must be synchronized with the following main voltage zero crossing, always. theperipheral can be programmed in order to work with 50 or 60 hz main voltage frequency by setting the reg_conf10(6) bit, psf (see table 10.4). if main voltage frequency is equal to 50 hz, then tr, see figure 10.9, is equal to 20 msec and t1 is: t1 = periph_reg_1(0:7)*(1/25.5)ms. the length of the semiperiod ti/2 is programmable by using the registers reg_conf12(0:5) and reg_conf13, (see figure 10.12).by using a clock master equal to 20 mhz the pulse width is in the range from 0.2 to 250 m s. the duty cycle of ti is always 50 %. in order to avoid problems for the triac firing when the load is inductive 8 different pulses are generated by the peripheral. if the time t1 is bigger than a fixed time tmax then no pulses are generatedand the triac is maintained off. this feature was implemented in order to avoid the firing of the triac in the second half period of the main voltage. the firing pulses are generated when the contents of the periph_reg_1 is less or equal to 204, otherwise they are not generated. when the frequency of the main voltage is 50 hz, t1max is equal to 8 msec. it is possible to generate a programmable interrupt in four different ways: 1) no interrupt; 2) interrupt on the rising edge of the signal main1 3)interrupt on the falling edge of the signal main2 4) interrupt on both the edges of the signal main1. the interrupt is programmableby using the register reg_conf11(7:6), intsl 10.4.triac/pwm driver programming 51/99 st52t301/e301
bit name value description 0 tcrst 0 triac reset 1 triac set 1 tcst 0 triac stop 1 triac start 2 mode 00 not used 01 pwm signal generator 3 10 burst mode (1) 11 phase partialization 4 cksl 00 clock master 01 external clock on main1 51x main voltage frequency 6 psf 0 main power at 50 hz 1 main power at 60 hz 7 iosl 0 main2 input pin 1 main2 output pin note: (1) cksl must be set to o1xo table 10.4 configuration register 10 description bit name value description 0 pol 0 output pulse polarity = positive 1 output pulse polarity = negative 1 tctrs 0 triacout status = tristate 1 triacout status = enabled 2 tcmsk masking time =(2^tcmsk*200 +100) ns. tcmsk=0 masking time=0 3 4 5 6 intsl 00 no interrupt source selected 01 interrupt on falling edge of the triac/pwm signal, or of the main voltage 7 10 interrupt on rising edge of the triac/pwm signal, or of the main voltage 11 interrupt on both of edges of the triac/pwm signa,l or of the main voltage table 10.5 configuration register 11 description bit name value description 0 5 utpmsb output impulse width most significative bits 6 inpsl 0 triac/pwm input from fuzzy output 1 triac/pwm input from register file 7 fzsl 0 triac/pwm input from fuzzy output 1 1 triac/pwm input from fuzzy output 2 table 10.6. configuration register 12 description it is possible set or reset the triac/pwm peripheral by using the reg_conf10(0) bit, tcrst (see table 10.4). if triac/pwm peripheral is set, it is possible start or stop it, by using the reg_conf10(1) bit, tcst (see table 10.4), to start or stop the internal counter without resetting it. it is possible to enablethe triacout, byusing the reg_conf11(0) bit, tctrs (see table 10.5 and figure 10.11). if tctrs is 0 the triac/pwm peripheraloutput is in tristate status. 52/99 st52t301/e301
figure 10.11. triac/pwm configuration register 10 figure 10.12 triac/pwm configuration register 11 figure 10.13 triac/pwm configuration registers 12 and 13 53/99 st52t301/e301
symbol parameter value unit v dd supply voltage -0.5 to 7 v v i input voltage v ss -0.3 to v dd +0.3 (1) v v o output voltage v ss -0.3 to v dd +0.3 (1) v v dda ,v ssa analog supply voltage v ss -0.3 to v dd +0.3 (1) v v pp eprom programming voltage 13 v i o standard output source sink current (2) 20 ma triacout output source sink current 80 (3) ma t opt operating temperature 0 to +85 c t stg storage temperature -65 to +150 c table 11.1. absolute maximum ratings note: stresses above those listed in the table oabsolute maximum ratingso may cause permanent damage to the device. these are stress ratings only and operation of the device at these or any other conditions above those indicated in the operating sections of this specification is not implied. exposure to absolute maximum rating conditions for extended periods may affect device reliability. refer also to the sgs-thomson sure program and other relevant quality documents. 1. wit hin these limits, clamping diodes are garanteed to be not conductive. 2. all except triacout pin 3. for not more than 1 sec. 11 electrical characteristics absolute maximum ratings this product contains devices to protect the inputs against damage due to high static voltages, however it is advised to take normal precaution to avoid any voltage higher than maximum rated voltagees. for proper operation it is recommended that v i and v o must be higher than v ss and smaller than v dd . reliability is enhanced if unused inputs are connected to an appropriated logic voltage level 54/99 st52t301/e301
( vss or vdd) recommended operating conditions (operating condition: v dd =5v 5%-t a =0 cto85 c, unless otherwise specified) symbol parameters test conditions min typ max unit v dd operating supply voltage 4.75 5.0 5.25 v v pp programming voltage 11.4 12 12.6 v v o ouput voltage v ss vdd v v dda ,v ssa analog supply voltage vss v ssa symbol parameter test conditions min typ max unit v il ttl type schmitt trig. low level input voltage vdd =4.75 v see fig.11.6 0.7 v cmos type schmitt trig. low level input voltage v dd =4.75 v see fig.11.7 1.2 v v ih ttl type schmitt trig. high level input voltage v dd =5.25 v see fig.11.6 2v cmos type schmitt trig. high level input voltage v dd =5.25 v see fig.11.7 3.5 v v ol standard low level output voltage i ol =4ma 0.4 v triacout low level output voltage i ol =50ma 2 v v oh standard high level output voltage (1) i ol =-4ma v dd -0.5 v triacout high level output voltage (1) i ol =50ma v dd -2 v v hys ttl type schmitt trig. hysteresis voltage see fig. 11.6 1.2 v cmos type schmitt trig. hysteresis voltage see fig. 11.7 2.0 v i il low level leakage input current v i =v ss -1 m a i ih high level leakage input current v i =v dd +4 m a i ol tri-state output leakage current v o =v ss or v dd 10 ma i dd supply current in reset mode v pp connected with v dd; v reset =v ss f osc = 10 mhz 11 ma supply current in run mode v pp connected with v dd; f osc = 10 mhz 11 ma i dda analog supply current in reset mode v pp connected with v dd; v reset =v ss f osc = 10 mhz 3ma analog supply current in run mode v pp connected with v dd; f osc = 10 mhz 10 ma table 11.3 dc electrical characteristics dc electrical characteristics (operating condition: v dd =5v 5%-t a =0 cto85 c, unless otherwise specified) 56/99 st52t301/e301
symbol parameter test conditions min typ max unit r s input protection resistor all input pins 1 k w c in input capacitance all input pins 10 pf c out output capacitance all ouput pins 10 pf table 11.4. ac electrical characteristics ac electrical characteristics (operating condition: v dd =5v 5%-t a =0 cto85 c, unless otherwise specified) symbol parameters test conditions min typ max unit f osc oscillator frequency 20 mhz t clh clock high 25 ns t cll clock low 25 ns t set setup see fig 11.1 5 ns t hld hold see fig. 11.1 5 ns t wreset minimum reset pulse width 100 ns t wint minimum external interrupt pulse width 100 ns t ir input rise time see fig.11.2 15 ns t if input fall time see fig.11.2 15 ns t or output rise time c load =10 pf see fig.11.2 10 ns t of output fall cload=10 pf see fig.11.2 10 ns table 11.5. timing parameters figure 11.1. data input timing figure 11.2. i/o rise and fall timing 57/99 st52t301/e301
figure 11.3. input pin equivalent circuit figure 11.4. equivalent tristate output circuit figure 11.5. equivalent output circuit 58/99 st52t301/e301
figure 11.6. ttl-level input schmitt trigger figure 11.7. cmos-level input schmitt trigger note: only for rete1 and reteio signals timer characteristics (operating condition: v dd =5v 5%-t a =0 cto85 c, unless otherwise specified) symbol parameter min typ max unit t res resolution 1/f osc m s f in external input frequency on timer internal input frequency on timer 20 mhz t w pulse width on timerout pin 1/f osc m s table 11.7. timer characteristics 59/99 st52t301/e301
a/d converter characteristics (operating condition: v dd =5v 5%-t a =0 cto85 c, unless otherwise specified) symbol parameter test conditions min typ max unit res resolution 8bit a tot total accuracy (1) f osc > 5 mhz f osc > 10 mhz f osc > 20 mhz 2 lsb t c conversion time f osc =5 - 10 - 20 mhz 32 m s v an conversion range v ssa 2.5 v v zi zero scale voltage conversion result= 00 hex v ssa v v fs full scale voltage (bandgap) conversion result= ff hex 2.474 v d v fs % full scale voltage (bandgap) precision v/s v dda variation vdda=5v 5% 1% ad i analog input current during conversion f osc = 20 mhz 2 ma ac in (2) analog input capacitance 2pf asi analog source impedance 1 k w ori output reference impedance 100 w orl output reference load 0.1 ma orlc analog reference load capacitance 10 pf source-off and drain-off leakage currents are in the range of na. notes: 1. noise at v dda, v ssa <40 mv 2. excluding pad capacitance. table 11.8. a/d converter characteristics 60/99 st52t301/e301
add addition format: add regi, regj operation: regi <- regi + regj description: the contents of the register file j-th register specified as source is added to the destina- tion i-th register, leaving the result in the destination register. the result is 255 if overflow occurs. flags: z set if result is zero, cleared otherwise. s set if overflow, cleared otherwise. bytes: 2 cycles: 7 example: if the register 4 contains the value 45 and the register 11 contains the value 15, then the instruction add 4,11 1001000 0100|1011 causes the register 4 of the register file to be loaded with the value 60. if the register 4 contains the value 200 and the register 11 contains the value 100, the in- struction causes the register 4 to be loaded with the value 44 (result-256) and the s flag to be set instruction set 61/99 st52t301/e301
and logical and format: and regi, regj operation: regi <- regi and regj description: the instruction logically ands the contents of the register file j-th register specified as source and the destination i-th register in the register file, leaving the result in the desti- nation register. flags: z set if result is zero, cleared otherwise. s not affected. bytes: 2 cycles: 7 example: if the register 4 contains the value 10011100 and the register 12 contains the value 01010101, then the instruction and 4,12 10010001 0100|1100 causes the register 4 of the register file to be loaded with the value 00010100. 62/99 st52t301/e301
con consequent format: con cost operation: dividend register <- dividend register + cost*teta divisor <- divisor + teta description: this intruction computes the values to add in the defuzzification registers, at the end of the single rule. the specified constant is the crisp value representing the output crisp membership function: it is multiplied by the last fuzzy operation result. 63/99 st52t301/e301
data membership functions data format: data var mbf lvd vtx rvd operation: adm location 16*var+mbf <- lvd adm location 16*var+mbf+64 <- vtx adm location 16*var+mbf+128 <- rvd description: this instruction is a pseudo instruction (it does not correspond to any operation executed by the processor) that allows to store membership functions data in the adm (antece- dent data memory). the var and the mbf data identify the membership function. the lvd data is the left semibase distance of the m.f., the vtx data is the position of the vertex and rvd is the right semibase distance. 64/99 st52t301/e301
fzand fuzzy and format: fzand operation: k <- stack0 and stack1 description: this instruction computes the and operation between the two values stored in the fuzzy stack, previously loaded with ldp, ldn or ldk instructions, and stores it in the register k. 65/99 st52t301/e301
fzor fuzzy or format: fzor operation: k <- stack0 or stack1 description: this instruction computes the or operation between the two values stored in the fuzzy stack, previously loaded with ldp, ldn or ldk instructions and stores it in the register k. 66/99 st52t301/e301
irq interrupt vector format: irq int label operation: interrupt vector <- label (pc = program counter) description: this instruction allows to specify the interrupt int service routine start address at label lo- cation. flags: z,s not affected. bytes: 2 cycles: 6 example: the instruction: irq 1 introut1 determinates that if interrupt 1 is serviced, the program counter (pc) is loaded with the memory address value labelled with introut1. remark: the instruction irq is a dummy instruction used to store data in the chip memory. it is neither stored in memory nor executed.a series of irq instructions must be ended by a dummy end operation. 67/99 st52t301/e301
irqm mask interrupt format: irqm mask operation: interrupt mask register <- mask description: the interrupts are masked with the specified mask. flags: z,s not affected. bytes: 2 cycles: 6 example: the instruction: irqm 10 1011|1110 00001010 enables the interrupts 1 and 3 and disables all the others. 68/99 st52t301/e301
irqp interrupt priority format: irqp cost operation: interrupt priority register <- cost description: the interrupts priority is set according the specified values. flags: z,s not affected. bytes: 2 cycles: 6 example: the instruction: irqp 198 1011|1111 11|00|01|10 determines the interrupt 2 to have highest priority, interrupt 1 medium priority and inter- rupt 0 lower priority. remark: each couples of bits must have different values, that is interrupts must have different priority level.enables the interrupts 1 and 3 and disables all the others. 69/99 st52t301/e301
jp unconditional jump format: jp addr operation: pc <- addr (pc = program counter) description: the instruction replaces the pc value with the specified value causing an unconditional jump to another location in the program memory. flags: z,s not affected. bytes: 2 cycles: 6 example: the instruction: jp 1123 1010|0100 01100011 causes the pc to be loaded with the value 1123 and the program to continue from that location. 70/99 st52t301/e301
jpns jump on non sign flag format: jpns addr operation: if s=0, pc <- addr (pc = program counter) description: if the s flag is cleared then the pc value is replaced with the specified value, causing a jump to another location in the program memory. flags: z,s not affected. bytes: 2 cycles: 6 example: if the s flag is cleared then the instruction: jpns 1123 1111|0100 01100011 causes the pc to be loaded with the value 1123 and the program to continue from that location. 71/99 st52t301/e301
jpnz jump on non zero flag format: jpnz addr operation: if z=0, pc <- addr (pc = program counter) description: if the z flag is cleared then the pc value is replaced with the specified value, causing a jump to another location in the program memory. flags: z,s not affected. bytes: 2 cycles: 6 example: if the z flag is cleared then the instruction: jpnz 1123 1101|0100 01100011 causes the pc to be loaded with the value 1123 and the program to continue from that location. 72/99 st52t301/e301
jps jump on sign flag format: jps addr operation: if s=1, pc <- addr (pc = program counter) description: if the s flag is set then the pc value is replaced with the specified value, causing a jump to another location in the program memory. flags: z,s not affected. bytes: 2 cycles: 6 example: if the s flag is set then the instruction: jps 1123 1110|0100 01100011 causes the pc to be loaded with the value 1123 and the program to continue from that location. 73/99 st52t301/e301
jpz jump on zero flag format: jpz addr operation: if z=1, pc <- addr (pc = program counter) description: if the z flag is set then the pc value is replaced with the specified value, causing a jump to another location in the program memory. flags: z,s not affected. bytes: 2 cycles: 6 example: if the z flag is set then the instruction: jpz 1123 1110|0100 01100011 causes the pc to be loaded with the value 1123 and the program to continue from that location. 74/99 st52t301/e301
ldcf load constant into configuration register format: ldcf conf, const operation: conf <- const description: the immediate constant value (const) specified as source is loaded into the destination peripheral configuration register (conf). flags: z,s not affected. bytes: 2 cycles: 6 example: the instruction: ldcf 5,43 1011|0101 00101011 causes the peripheral configuration register 5 to be loaded with the value 43. 75/99 st52t301/e301
ldk load stack with k register format: ldk operation: stack0 <- k description: this instruction loads in the stack the value temporarily stored in the register k that is the result of the last fuzzy operation. 76/99 st52t301/e301
ldm load stack with m register format: ldm operation: stack0 <- m description: this instruction loads in the stack the value temporarily stored in the register m with a skm operation. 77/99 st52t301/e301
ldn load negative alpha value format: ldn var mbf operation: stack <- 15 - computed alpha value related to mbf m.f. of var variable description: this instruction performs the fuzzyfication and loads in the stack the negated alpha value of the m.f. mbf of var variable. 78/99 st52t301/e301
ldp load positive alpha value format: ldp var mbf operation: stack <- computed alpha value related to mbf m.f. of var variable description: this instruction performs the fuzzyfication and loads in the stack the alpha value of the m.f. mbf of var variable. 79/99 st52t301/e301
ldpr load register into peripheral register format: ldpr per, reg operation: per <- re g description: the contents register specified as source (reg) is loaded into the destination peripheral register (per). flags: z, s not affected. bytes: 1 cycles: 5 (6 if parallel port with h/s is addressed) example: if the register 7 of the register file contains the value 25 then the instruction: ldpr 2,7 01|10|0111 causes the register 2 of the peripheral register (i.e. parallel port) to be loaded with the value 25. 80/99 st52t301/e301
ldrc load constant into register format: ldrc reg, const operation: reg <- const description: the immediate constant value specified as source is loaded into the destination register in the register file. flags: z,s not affected. bytes: 2 cycles: 6 example: the instruction: ldrc 5,43 1000|0101 00101011 causes the register 5 of the register file to be loaded with the value 43. 81/99 st52t301/e301
ldri load input register into register file format: ldri reg, inp operation: reg <- inp description: the contents of a input register specified as source (inp) is loaded into the destination register in the register file (reg). flags: z,s not affected. bytes: 2 cycles: 6 example: if the register 2 of the a/d converter contains the value 25 then the instruction: ldri 5,2 000|xxxxx 0101|0010 x = don't care causes the register 5 of the register file to be loaded with the value 25. 82/99 st52t301/e301
ldrr load register into register format: ldrr regi, regj operation: regj <- regi description: the contents of the register file j-th register specified as source is loaded into the desti- nation i-th register. flags: z,s not affected. bytes: 2 cycles: 6 example: if the register 2 of the register file contains the value 25 then the instruction: ldrr 5,2 10010110 0101|0010 causes the register 5 of the register file to be loaded with the value 25. 83/99 st52t301/e301
mdgi macro disable global interrupt format: mdgi operation: mgi bit <- 0 description: all the interrupts are disabled by this instruction. this instruction is used by fuzzystu- dio ? 3.0 compiler macros to disable interrupt during macro execution. flags: z,s not affected. bytes: 1 cycles: 4 example: after the instruction: mdgi 10011010 all the interrupts cannot be acknowledged and remain pending 84/99 st52t301/e301
megi macro enable global interrupt format: mdgi operation: mgi bit <- 1 description: the not masked interrupts are enabled by this instruction only if a udgi instruction has not specified before, not followed by a uegi instruction. this instruction is used by fuzzystudio ? 3.0 compiler macros to disable interrupt during macro execution. flags: z,s not affected. bytes: 1 cycles: 4 example: after the instruction: megi 10011011 not masked interrupts can be acknowledged if the interrupts are not globally disabled by the udgi instruction 85/99 st52t301/e301
out output computation format: out const operation: output register const <- defuzzyfication result of the const output description: this instruction performs the defuzzyfication of the specified output (const can assume only the values 0 or 1) and loads in the correspondent fuzzy output register the result. 86/99 st52t301/e301
reti return from interrupt format: reti operation: pc <- stack z <- stack s <- stack description: this instruction resumes the program execution exactly at the point it was left when an in- terrupt occurred. z and s flag are set to the status they had when the interrupt service routine was started. flags: z,s restored to the original setting before an interrupt occured. bytes: 1 cycles: 5 example: if the pc stack contains the value 1123 and the program is processing an interrupt ser- vice routine, then the instruction reti 10010101 causes the pc to be loaded with the value 1123 and the flags to be restored to the status before the interrupt occurred. 87/99 st52t301/e301
rint reset interrupt format: rint int operation: cancel pending interrupt n. int description: the specified pending interrupt is cancelled if not currently in service. flags: z,s not affected. bytes: 1 cycles: 4 example: the instruction: rint 2 0001|x|010 x = don't care causes the bit 2 of the interrupt pending register to be cleared so that the interrupt 2 is not acknowledged. remark: the use of rint istruction has no effect if a specified interrupt has already been aknowl- edged and related service routine has not been completed. 88/99 st52t301/e301
skm store k register in m register format: skm operation: m<-k description: this instruction stores the result of the last performed fuzzy operation (stored in the tem- porary register k) in the temporary buffer m. 89/99 st52t301/e301
srx sci reception format: srx regi operation: regi <- scdr_rx description: the contents of the scdr_rx block of the sci receiver block, is transferred in the reg- ister file i-th register specified as destination. flags: z,s not affected. bytes: 2 cycles: 5 example: if the scdr_rx block of the sci receiver block contains the value 45, then the instruc- tion srx 4 00101101 causes the register 4 of the register file to be loaded with the value 45. 90/99 st52t301/e301
stop stop program execution format: stop operation: stop section description: this instruction separates arithmetic instructions and fuzzy instructions. also it ends a irq specification section. flags: z,s not affected. bytes: 1 cycles: 4 example: the instruction: stop 10010111 if put after arithmetic instructions, it allows to start a block of fuzzy instruction and vice versa. 91/99 st52t301/e301
stx sci transmission format: stx regi operation: scdr_tx <- regi description: the contents of the register file i-th register specified as source is transferred in the scdr_tx block of the sci transmitter block, to be transmitted. flags: z,s not affected. bytes: 2 cycles: 5 example: if the register 4 contains the value 45, then the instruction stx 4 00101101 causes the serial transmission of 45. 92/99 st52t301/e301
sub subtraction format: sub regi, regj operation: regi <- regi -regj description: the contents of the register file j-th register specified as source is subtracted from the destination i-th register, leaving the result in the destination register. flags: z set if result is zero, cleared otherwise. s set if underflow, cleared otherwise. bytes: 2 cycles: 7 example: if the register 4 contains the value 45 and the register 11 contains the value 15, then the instruction sub 4,11 10010010 0100|1011 causes the register 4 of the register file to be loaded with the value 30. if the register 4 contains the value 100 and the register 11 contains the value 200, the in- struction causes the register 4 to be loaded with the value 156 (result+256) and the s flag to be set. 93/99 st52t301/e301
subo subtraction with offset format: subo regi, regj operation: regi <- regi - regj +128 description: the contents of the register file register specified as source are subtracted from the destination register in the register file, the value 128 is added to the result that is stored in the destination register. this operation allows the use of the signed byte considering the values between 0 and 127 as negative, 128 as 0, and the values between 129 and 255 as positive. flags: z set if result is zero or if overflow occurs, cleared otherwise. s set if underflow or overflow, cleared otherwise. bytes: 2 cycles: 7 example: if the register 4 contains the value 45 and the register 11 contains the value 15, then the instruction subo 4,11 10010011 0100|1011 causes the register 4 of the register file to be loaded with the value 158. the value 45 corresponds to -83, the value 11 corresponds to -113; so the operation is equivalent to perform -83 - (-113) = 30. as a matter of fact the result 158 corresponds to the value 30. if the register 4 contains the value 50 and the register 11 contains the value 200, the in- struction causes the register 4 to be loaded with the value 234 (result+256) and the s flag to be set. if the register 4 contains the value 200 and the register 11 contains the value 50, the in- struction causes the register 4 to be loaded with the value 22 (result-256) and the s and z flags to be set. 94/99 st52t301/e301
udgi user disable global interrupt format: udgi operation: ugi bit <- 0 description: all the interrupt are disabled by this instruction. flags: z,s not affected. bytes: 1 cycles: 4 example: after the instruction: udgi 10011000 all the interrupts cannot be acknowledged and remain pending. 95/99 st52t301/e301
uegi user enable global interrupt format: uegi operation: ugi bit <- 1 description: all the interrupts are enabled by this instruction. flags: z,s not affected. bytes: 1 cycles: 4 example: after the instruction: uegi 10011001 not masked interrupts can be acknowledged if the interrupt are not globally disabled by the mdgi instruction. 96/99 st52t301/e301
waiti wait for interrupt format: waiti operation: wait state description: this instruction causes the program to stop, without halting the peripherals, until an inter- rupt occurs. . flags: z,s not affected. bytes: 1 cycles: 4 example: the instruction: waiti 10010100 halts the program execution leaving the peripherals running on, until an interrupt occurs. 97/99 st52t301/e301
dim mm inch. min typ max min typ max a 17.27 17.78 .680 .662 b 16.33 16.81 .643 .662 c 12.01 .475 c1 13.03 .513 c1 1.30 0.52 d 1.82 2.23 0.72 .088 d1 0.889 .035 d2 2.362 .093 e 16.26 16.76 .640 .660 e 1.27 .050 e3 12.50 .500 f 0.431 .017 f1 0.762 .030 f2 0.965 .038 m 0.508 .020 m1 1.016 .040 r 0.762 .030 clcc44 package mechanical data 98/99 st52t301/e301
dim mm inch. min typ max min typ max a 17.4 17.65 0.685 0.695 b 16.51 16.65 0.650 0.656 c 3.65 3.7 0.144 1.146 d 4.2 4.57 0.165 0.180 d1 2.59 2.74 0.102 0.108 d2 0.68 0.027 e 14.99 16 0.590 0.630 e 1.27 0.050 e3 1.27 0.500 f 0.46 0.018 f1 0.71 0.028 g 0.101 0.004 m 1.16 0.046 m1 1.14 0.045 plcc44 package mechanical data 99/99 st52t301/e301
full product information at http://www.st.com information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specification mentioned in this publication are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics products are not authorized for use as critical components in lifesupport devices or systems without express written approval of stmicroelectronics. the st logo is a registered trademark of stmicroelectronics ? 1998 stmicroelectronics printed in italy all rights reserved fuzzystudio ? is a registered trademark of stmicroelectronics dualogic ? is a trademark of stmicroelectronics ms-dos ? , microsoft ? and microsoft windows ? are registered trademarks of microsoft corporation. matlab ? is a registered trademark of mathworks inc. stmicroelectronics group of companies australia - brazil - canada - china - france - germany - italy - japan - korea - malaysia - malta - mexico - morocco - the netherlands - singapore - spain - sweden - switzerland - taiwan - thailand - united kingdom - u.s.a. part number package st52e301/c clcc44-w st52t301/p plcc44 ordering information st52t301/e301


▲Up To Search▲   

 
Price & Availability of ST52E301C

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X